package com.cy.personer.web;

import com.cy.personer.bean.Combo;
import com.cy.personer.bean.Item;
import com.cy.personer.bean.Suggest;
import com.cy.personer.bean.Summary;
import com.cy.personer.biz.ComboBiz;
import com.cy.personer.biz.SuggestBiz;
import com.cy.personer.biz.SummaryBiz;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

import static com.cy.personer.util.BarcodeUtil.generateFile;

@Controller
@RequestMapping("/summary")
public class SummaryHandler {

    @Resource
    SummaryBiz summaryBizImpl;

    /**
     * 增加总结
     * @author 林少艺
     */
    @RequestMapping(value = "/addSummary.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String addSummary(Summary summary){
        return ""+summaryBizImpl.addSummary(summary);
    }

    /**
     * 修改总结
     * @author 林少艺
     */
    @RequestMapping(value = "/updateSummary.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String updateSummary(Summary summary){
        return ""+summaryBizImpl.updateSummary(summary);
    }

    /**
     * 查找总结列表
     * @author 林少艺
     */
    @RequestMapping(value = "/getSummarys.action", method= RequestMethod.POST, produces="application/json;charset=utf-8")
    public @ResponseBody
    PageInfo<Summary> getSummarys(Summary summary,int pageNum) {
        return summaryBizImpl.getSummarys(summary,pageNum);
    }

    /**
     * 查找总结
     * @author 林少艺
     */
    @RequestMapping(value = "/getSummary.action", method= RequestMethod.POST, produces="application/json;charset=utf-8")
    public @ResponseBody
    Summary getSummary(Summary summary){
        return summaryBizImpl.getSummary(summary);
    }

    /**
     * 删除总结
     * @author 林少艺
     */
    @RequestMapping(value = "/delSummary.action", method= RequestMethod.POST, produces="text/html;charset=utf-8")
    public @ResponseBody
    String delSummary(Summary summary){
        return ""+summaryBizImpl.delSummary(summary);
    }
}
